#include<iostream>
using namespace std;
static int a=0;
/*
class A
{
    public:
    A()
    {
        cout<<"in A()"<<endl;
        cout<<a++<<' ';
        p=this;
    }
    virtual void f1(){cout<<"in f1"<<endl;}
    protected:
    A* p;
};

class B :public A
{
    public:
    B()
    {
        cout<<"in B()"<<endl;
    }
    virtual void f1(){cout<<"in f2"<<endl;}
    void f2(){p->f1();}
};

int main()
{
    //A a;
    //a.f1();
    B b;
    b.f2();
}
*/

class A
{
    public:
    A()
    {
        cout<<"in A()"<<endl;
        cout<<a++<<' ';
        //p=this;
    }
    virtual void f1(){cout<<"in f1"<<endl;}
    protected:
    A p;
};
/*
class B :public A
{
    public:
    B()
    {
        cout<<"in B()"<<endl;
    }
    virtual void f1(){cout<<"in f2"<<endl;}
    void f2(){p->f1();}
};
*/

int main()
{
    A a;
    //a.f1();
    //B b;
    //b.f2();
}
